package HuaRongDao;

import javax.swing.*;
import java.awt.*;

public class HelpPanel extends JPanel{

    String[] names = new String[]{"七步成诗","横刀立马","屯兵东路","插翅难飞","巧过五关","层层设防","近在咫尺","兵临曹营","众志成城","佳人梳妆"};//十个关卡的名字
    int level;
    JPanel panelNorth = new JPanel(new GridLayout(4,2,10,30));
    static JLabel nowStep = new JLabel("0");
    JLabel nowName = new JLabel("");
    JLabel record = new JLabel("");
    static	JButton restart = new JButton("重置");

    public HelpPanel(int level){
        this.level = level;
        this.setVisible(true);
        this.setLayout(new BorderLayout());//当前面板
        panelNorth.add(new JLabel("关卡名字："));
        panelNorth.add(nowName);
        panelNorth.add(new JLabel("当前步数："));
        panelNorth.add(nowStep);
        panelNorth.add(new JLabel("历史记录："));
        panelNorth.add(record);//历史记录
        panelNorth.add(restart);

        this.add(panelNorth,BorderLayout.NORTH);
        initialize();
    }

    public void setLevel(int level){
        this.level = level;
        initialize();
    }

    private void initialize() {
//		System.out.println("level is "+level);
//		System.out.println(names[level-1]);
        nowName.setText(names[level-1]+"");
        nowStep.setText("0");
        record.setText(""+MapFactory.getRecord(level));
    }

}